home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
gnu
/
objcissu.lha
/
preprocessor
< prev
next >
Wrap
Internet Message Format
|
1993-03-01
|
1KB
Date: Mon, 21 Sep 92 02:29:37 -0400
From: athan@object.com (Andrew C . Athan)
To: gnu-objc@prep.ai.mit.edu
Subject: Preprocessor & class/instance methods
By the way:
(1) Has anyone considered expanding the preprocessor functionality? One useful set of features might allow method calls to be rewritten.
E.g., in ANSI C I can do:
#define foobar(a,b,c) barbar(c,a,b)
but how can I rewrite:
[foo setThis:a toThat:b from:c] --> [foo setThat:b toThis:a from:c]
(2) I think we need to think about the nature of class vs. instance
method declarations. There are some inconsistencies/deficiencies in
the language <as was discussed in the @protocol thread> regarding
their declarations. One definite miss is the inability to declare a
pointer to a _class_ object.
Another possible feature would be the ability to declare
class&instance methods. I.e., a method that both the class and the
instance responds to (of course, the method code cannot therefore
refer to any instance variables). E.g.:
-+ countDigitsOf:(const char *)s { ... };
instead of
+ countDigitsOf:(const char *)s { ... };
- countDigitsOf:(const char *)s { [[self class] countDigitsOf:s]; }
The semantics would be that countDigitsOf: is added to the method
dispatch table of both the class and instance objects. I.e., the
call is exactly equivalent. This would work because in theory the
instance object is a subclass of it's class object's class (Object).
Andrew Athan